package dao;

/**
 *
 * @author Human Booster
 */
public class DaoFactory {

    static final String daoType = "SQL";
    static String role = "anonymous";

    public static ICustomerDao createCustomerDao() {
        switch (daoType) {
            case "SQL":
                switch (role) {
                    case "anonymous":
                        return new SqlCustomerDaoAnonymous();
                    case "admin":
                        return new SqlCustomerDaoAdmin();
                    case "customer":
                        return new SqlCustomerDaoCustomer();
                }
            case "MOCK":
                return null;
            default:
                return null;
        }
    }

    public static IOrderDao createOrderDao() {
        switch (daoType) {
            case "SQL":
                switch (role) {
                    case "anonymous":
                        return new SqlOrderDaoAnonymous();
                    case "admin":
                        return new SqlOrderDaoAdmin();
                    case "customer":
                        return new SqlOrderDaoCustomer();
                }
            case "MOCK":
                return null;
            default:
                return null;
        }
    }

    public static ISoftwareDao createSoftwareDao() {
        switch (daoType) {
            case "SQL":
                switch (role) {
                    case "anonymous":
                        return new SqlSoftwareDaoAnonymous();
                    case "admin":
                        return new SqlSoftwareDaoAdmin();
                    case "customer":
                        return new SqlSoftwareDaoCustomer();
                }
//                return new SqlCustomerDaoAdmin();
            case "MOCK":
                return null;
            default:
                return null;
        }
    }

    public static String getRole() {
        return role;
    }

    public static void setRole(String role) {
        DaoFactory.role = role;
    }
}
